package com.cheer.enums;

/**
 * @author cheer
 */
public enum MallOrderStatusEnum {

    TO_PAY(0, "待付款"),
    TO_DELIVER(1, "待发货"),//待发货，待消费
    DELIVERED(2, "已发货"),
    FINISHED(3, "已完成"),//已完成，已消费
    CLOSED(4, "已关闭");

    private Integer code;
    private String message;

    MallOrderStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String forCode(Integer code) {
        for (MallOrderStatusEnum orderStatusEnum : MallOrderStatusEnum.values()) {
            if (orderStatusEnum.getCode().equals(code)){
                return orderStatusEnum.getMessage();
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
